import { InvoiceOrderDispatchDto, InvoiceOrderQueryDto } from '@/dtos';
import { InvoiceOrderService } from '@/services/invoice-order.service';
import { ok } from '@/utils';
import { Body, Controller, Patch, Post } from '@nestjs/common';
import { BaseController } from './base.controller';

@Controller('invoice-order')
export class InvoiceOrderController extends BaseController {
  constructor(private readonly invoiceOrderService: InvoiceOrderService) {
    super();
  }

  @Post('admin/query')
  async query(@Body() dto: InvoiceOrderQueryDto) {
    return ok(await this.invoiceOrderService.query(dto));
  }

  @Patch('admin/dispatch')
  async dispatch(@Body() dto: InvoiceOrderDispatchDto) {
    return ok(await this.invoiceOrderService.dispatch(dto));
  }
}
